const toggles = document.querySelectorAll(".faqToggle");
var toggle = document.getElementById("faqContainer")
// toggles.forEach(toggle => {
//普通方法 循环添加事件
//     toggle.addEventListener("click",() => {
//         toggle.parentNode.classList.toggle("active")
//     })
// })
if (toggle) {
    //事件委托 更加节省内存
    toggle.addEventListener("click",function (event) {
        event = event || window.event;
        let target = event.target;
        let tagName = event.target.tagName;
        if (tagName == 'I' ) {
            target.parentNode.parentNode.classList.toggle("active")
        }
        else if (tagName == 'BUTTON'){
            target.parentNode.classList.toggle("active")
        }
    })
}